package com.verisette.framework.basic.common.config;

import java.util.Map;

import org.apache.log4j.Logger;
import org.corp.agi.basic.common.util.LogFormatter;
import org.corp.agi.basic.persistence.dao.ConfigDAO;
import org.corp.agi.common.config.SystemConfig;

public class SystemConfigImpl implements SystemConfig{
	
	private static Logger logger = Logger.getLogger(SystemConfigImpl.class);	
	
	ConfigDAO configDAO;
	public void setConfigDAO(ConfigDAO configDAO) {
		this.configDAO = configDAO;
	}
	
	public String getConfigValue( String configKey ){
		Map systemConfigMap = configDAO.getSystemConfigMap();
		String configValue = (String) systemConfigMap.get(configKey);
		if( configValue == null ){
			logger.error( LogFormatter.format("-", "-", LogFormatter.TYPE_CONFIG_ERROR, LogFormatter.OP_ENGINE, 
						  "Cannot find System Param : SystemParamName = " + configKey ) );
		}
		return configValue;
	}

}
